package com.ftg.learn.mapper;

import com.ftg.learn.entity.SysUser;
import com.ftg.learn.util.R;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 布衣
 */
@Mapper
public interface SysUserMapper {

    @Select("select * from sys_user where account = #{account} and password = #{password}")
    SysUser findByAccount(@Param("account") String account, @Param("password") String password);

    @Insert("insert into sys_user(account, password) values(#{account}, #{password})")
    int register(@Param("account") String account, @Param("password") String password);

    @Insert("insert into sys_user_role(roleid, userid) values(#{roleId},#{userId})")
    Integer assignRole(@Param("userId") Integer userId, @Param("roleId") Integer roleId);
}
